<%@page import="java.util.ArrayList"%>
<%@page import="cs236369.hw5.DBConnection"%>
<%@page import="cs236369.hw5.Skill"%>
<%@page import="java.util.Date"%>
<%@ page import="cs236369.hw5.InitListener" %>
<%@ page language="java" contentType="text/html; charset=windows-1255"
    pageEncoding="windows-1255"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=windows-1255" />
	<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
	<!-- initialize google maps scripts and what to load -->
	<script src="googleMapScripts.js" type="text/javascript"></script>
	<script> 
		googleMapScripts_loadTasks=true;		
		googleMapScripts_loadTeams=true;		
		googleMapScripts_loadMatches=true; 
	</script>
</head>
<body class="mapPageBody">
	<%
		String name = (String)session.getAttribute("name");
		if(name == null) {
			response.sendRedirect(request.getContextPath() + InitListener.welcomePage);
			return;
		}
	%>
	<p class="subtitle">Create a new team</p>
	<p class="topic">Select position:</p>
	<div id="map-canvas" class="map-canvas"></div>
	<div class="text"><form action="#" method="post" id="addPost">
		<p class="topic">Team Information</p>
		<label>Team name:&nbsp;</label>
		<input type="text" name="taskname" id="taskname"/><br />
		<label>Maximum number of people can join the team:&nbsp;</label>
		<input type="text" name="limit" id="limit"/><br />
		<label>Maximum number of people the team can evacuate:&nbsp;</label>
		<input type="text" name="capacity" id="capacity"/><br />
		<label>Description:&nbsp;</label>
		<input type="text" name="content" id="content" /><br />
		<label>Select skills:</label> <br />
		<select id="skill1" onchange="addSkillBox(this)">
		<option value="" disabled="disabled" selected="selected">Select skills</option>
		<%
			ArrayList<Skill> skills = DBConnection.getSkills(true);
			int optIndex=1;
			for(Skill s : skills) {
				out.println("<option id=\"opt" + s.getId() + "\" value=\"" + s.getId() + "\">" + s.getSkill() + "</option>");
				optIndex++;
			}
		%>
		</select>
		<div id="skillsListDiv" class="text"></div><br />
		<input type="hidden" name="latPos" id ="latPos"></input>
		<input type="hidden" name="lngPos" id ="lngPos"></input>
		<input type="button" value="Add" class="regularButton" onclick="addPost('AddTeam', 'team.jsp')"/>
	</form></div>
</body>
</html>
